package com.lbn.jfqsc.app.recruitment;

import android.Manifest;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioGroup;

import com.lbn.baseframe.base.BaseFragment;
import com.lbn.baseframe.widget.FragmentTabAdapter;
import com.lbn.jfqsc.R;
import com.lbn.jfqsc.app.recruitment.adapter.ADAdapter;
import com.lbn.jfqsc.app.recruitment.item.RecruitmentItemFragment;
import com.lbn.jfqsc.widget.PhotoDialog;
import com.lypeer.fcpermission.FcPermissions;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class RecruitmentFragment extends BaseFragment<RecruitmentPresenter> implements IRecruitmentView {


    @BindView(R.id.view_pager)
    ViewPager viewPager;
    @BindView(R.id.time_switch)
    RadioGroup timeSwitch;
    private ADAdapter adAdapter;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (rootView == null) {
            rootView = inflater.inflate(R.layout.fragment_recruitment, null, false);
            ButterKnife.bind(this, rootView);
        }
        return rootView;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);


    }

    @Override
    protected void onPresenterCreated() {
        super.onPresenterCreated();
        List<Integer> list = new ArrayList<>();
        list.add(R.mipmap.ic_launcher);
        adAdapter = new ADAdapter(getContext(), list, viewPager);
        viewPager.setAdapter(adAdapter);
        adAdapter.start();
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(RecruitmentItemFragment.newInstance(1));
        fragments.add(RecruitmentItemFragment.newInstance(2));
        new FragmentTabAdapter(getActivity(), fragments, R.id.fragment_recycler_view, timeSwitch);
    }

    public static RecruitmentFragment newInstance() {
        RecruitmentFragment fragment = new RecruitmentFragment();
        return fragment;
    }

    @Override
    public RecruitmentPresenter createPresenter() {
        return new RecruitmentPresenter();
    }


}
